package com.sunchen.asc.service.user.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sunchen.asc.service.user.vo.InsertRoleVo;
import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

@Data
public class RoleDto implements Serializable {

    private Long id;

    private String name;

    private Integer status;

    private String title;

    private String description;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createTime;
    private String createUser;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp deleteTime;
    private String deleteUser;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp updateTime;
    private String updateUser;

    //权限
    private List<Long> authenticationIds;
    private String authString;

    public RoleDto(){}

    public RoleDto(InsertRoleVo insertRoleVo) {
        this.id = insertRoleVo.getId() == null?null:Long.valueOf(insertRoleVo.getId());
        this.name = insertRoleVo.getName();
        this.status = insertRoleVo.getStatus();
        this.title = insertRoleVo.getTitle();
        this.description = insertRoleVo.getDescription();

        this.authenticationIds = insertRoleVo.getAuthIds();
    }
}
